home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
089a.dms
/
089a.adf
/
EXAMPLE_PROGRAMS
/
example20.AMOS
/
example20.amosSourceCode
Wrap
AMOS Source Code
|
1992-03-06
|
2KB
|
88 lines
'=================
Rem EXAMPLE20.Amos
'=================
Rem examples of X MOUSE Y MOUSE and LIMIT MOUSE
Screen Open 0,640,250,8,Hires
Curs Off : Paper 0 : Cls 0
Rem call the two procedures then go back to the editor
'-----------------------------------------------------
_MADMOUSE
_PARAMOUSE
Edit
Rem procedures start here
'------------------------
Procedure _MADMOUSE
Rem A bit of fun with xmouse and ymouse
Pen 3
Locate 0,10 : Centre "OH NO! LOOKS LIKE YOU HAVE LOST CONTROL OF YOUR MOUSE."
Pen 2
'
'
MX=260 : MY=100
'
Rem loop 400 times
'-----------------
For A=1 To 400
Rem give + and - rnd movement to each axis
'-----------------------------------------
MX=MX+Rnd(4) : MY=MY+Rnd(4)
MX=MX-Rnd(4) : MY=MY-Rnd(4)
Rem place the pointer in its new position
'----------------------------------------
X Mouse=MX : Y Mouse=MY
Wait Vbl
Rem print the x,y coordinates of the mouse
'-----------------------------------------
Locate 30,12 : Print "X MOUSE=";X Mouse;" "
Locate 30,14 : Print "Y MOUSE=";Y Mouse;" "
Next A
Rem now smooth moves
Rem start the pointer at top left edge of screen
'------------------------------------------------
X Mouse=112 : Y Mouse=0
Rem four simple for next moves moves the mouse a pixel at a time
'---------------------------------------------------------------
For A=0 To 120 : X Mouse=X Mouse+1 : Y Mouse=Y Mouse+1 : Wait Vbl : Next A
For A=0 To 120 : X Mouse=X Mouse-1 : Y Mouse=Y Mouse+1 : Wait Vbl : Next A
For A=0 To 120 : X Mouse=X Mouse+1 : Y Mouse=Y Mouse-1 : Wait Vbl : Next A
For A=0 To 120 : X Mouse=X Mouse-1 : Y Mouse=Y Mouse-1 : Wait Vbl : Next A
End Proc
Procedure _PARAMOUSE
Change Mouse 3
Paper 2 : Pen 0 : Ink 0 : Cls 2
Rem draw a box
'-------------
Box 105,110 To 400,160
Locate 16,16 : Print "A PARALYSED MOUSE TRY TO MOVE IT"
Rem freeze the mouse by limiting both axis to same coordinate
'-------------------------------------------------------------
Limit Mouse 272,190 To 272,190
Wait 400
Locate 14,16 : Print "YOU ARE NOW A PRISONER OF THIS BOX"
Change Mouse 2
'
Rem limit inside box, note different coords to box these are hardware coords
'----------------------------------------------------------------------------
Limit Mouse 180,160 To 328,210
Wait 400
Rem RELEASE THE MOUSE BY Limit Mouse WITH NO COORDS
'--------------------------------------------------
Limit Mouse
Change Mouse 1
Locate 26,18 : Print "FREEDOM!"
Wait 200
End Proc